<?php

namespace App\Http\Controllers\Api\V1;

use App\Models\PlayType;
use Illuminate\Http\Request;
use App\Http\Controllers\Controller;

class ExtendController extends Controller
{
    /**
     * @SWG\Get(
     *     summary="扩展数据",
     *     path="/extend",
     *     description="获取所有扩展数据",
     *     produces={"application/x-www-form-urlencoded"},
     *     @SWG\Response(
     *         response=200,
     *         description=""
     *     )
     * )
     *
     * @return array
     */
    public function index()
    {
        $handle = [];
        $playType = PlayType::all();
        foreach ($playType as $item) {
            $handle[$item->type][] = [
                'id' => $item->id,
                'title' => $item->title
            ];
        }

        $data = [
            'usage' => $handle[1],
            'function' => $handle[2],
            'style' => $handle[3]
        ];

        return $data;
    }
}
